import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VehicleInfoVO, VehicleInfoForm, VehicleInfoQuery } from '@/api/painting/vehicleInfo/types';

/**
 * 查询车辆信息列表
 * @param query
 * @returns {*}
 */

export const listVehicleInfo = (query?: VehicleInfoQuery): AxiosPromise<VehicleInfoVO[]> => {
  return request({
    url: '/painting/vehicleInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询车辆信息详细
 * @param id
 */
export const getVehicleInfo = (id: string | number): AxiosPromise<VehicleInfoVO> => {
  return request({
    url: '/painting/vehicleInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增车辆信息
 * @param data
 */
export const addVehicleInfo = (data: VehicleInfoForm) => {
  return request({
    url: '/painting/vehicleInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改车辆信息
 * @param data
 */
export const updateVehicleInfo = (data: VehicleInfoForm) => {
  return request({
    url: '/painting/vehicleInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除车辆信息
 * @param id
 */
export const delVehicleInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/painting/vehicleInfo/' + id,
    method: 'delete'
  });
};
